$(function(){
    $("#loginForm").submit(function () {
        $.ajax({
            url: wxUrl.login,
            type:"post",
            dataType:"json",
            contentType:"application/json",
            data:JSON.stringify({
                "userName": $("#userName").val(),
                "passWord": $("#passWord").val()
            }),
            success:function (resp) {
                // console.log(resp)
                if(resp.code==0){
                    let token = resp.token
                    localStorage.setItem("token",token)
                    // console.log("SUCCESS")

                    //跳转到native订单页
                    location.href = "./page/order.html"

                    //跳转到扫码付款订单页
                    // location.href = "./page/payment.html"

                    //跳转到支付大屏页面
                    // location.href = "front/chart.html"
                }
           }
        })
        return false
    })

    $.ajax({
        url: "https://api.ipify.org/?format=json",
        type: "GET",
        dataType: "json",
        success: function (resp) {
            let ip = resp.ip
            localStorage.setItem("ip",ip)
        }
    })
})